package com.ly.lypopupwindowdemo.activity;

import android.graphics.Bitmap;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.ly.lypopupwindowdemo.R;

import java.util.List;

import butterknife.BindArray;
import butterknife.BindBitmap;
import butterknife.BindColor;
import butterknife.BindString;
import butterknife.BindView;
import butterknife.BindViews;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnLongClick;

public class ButterKnifeDemoActivity extends AppCompatActivity {


    // 注意：button 的修饰类型不能是：private 或者 static 。
    // 否则会报错：错误: @BindView fields must not be private or static.
    // (com.zyj.wifi.ButterknifeActivity.button1)
    @BindView(R.id.id_xiaoshuo1)
    Button xiaoshuo1;

    @BindViews({R.id.id_peilian1,R.id.id_peilian2})
    public List<Button> buttonList;

    @BindString(R.string.bind_string)
    String jianjie_str;
    @BindView(R.id.id_text)
    TextView text;

    @BindArray(R.array.titlename)
    String[] titles;
    @BindView(R.id.id_text_array)
    TextView text_array;

    @BindBitmap(R.mipmap.lufei1)
    Bitmap lufei;
    @BindView(R.id.iv)
    ImageView iv;


    @BindColor(R.color.google_red)
    int google_red;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_butter_knife_demo);

        ButterKnife.bind(this);

        text.setText(jianjie_str);
        text_array.setText(titles[2]);
        iv.setImageBitmap(lufei);
        text_array.setTextColor(google_red);
    }

    @OnClick(R.id.id_xiaoshuo1)
    public void onClick(){
        Animation anim1 = AnimationUtils.loadAnimation(this,R.anim.anim_rotate);
        iv.startAnimation(anim1);
    }

    @OnLongClick(R.id.id_peilian1)
    public boolean onLongClick(){
        Toast.makeText(this, "BAZINGGA!!!", Toast.LENGTH_SHORT).show();
        return true;
    }

}
